Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

Mime conversion in Lotus Script does not do what I want!
~Hank Chufanaskiettu 01/28/2004 01:08 PM
Applications Development 6.5 All Platforms

Hi there,

I try to send some email as MIME. I have the HTML text stored in a field and use the agent code below. When I send the message to a Notes or Yahoo user (this is where I tested it) the content type shows text/html. If I inspect the Body Properties in Notes the full HTML is there. However neither in Notes nor yahoo the HTML tags are rendered. I'm very clueless what I miss out. Any help?
:-) stw
The function:
Sub MailThisDoc(mdb As NotesDatabase, doc As NotesDocument)
'Sends a copy of the document, rendered as HTML
Dim mDoc As NotesDocument
Dim mBody As NotesItem 'item
Dim mHTMLBody As NotesItem 'HTML Version of Body

Dim body As NotesMIMEEntity
Dim header As NotesMIMEHeader

Dim stream As NotesStream
Dim s As New NotesSession

On Error Goto Err_MailThisDoc

Set mDoc = New NotesDocument(mdb)

Set stream = s.CreateStream
Set mHTMLBody = doc.GetFirstItem("BodyHTML")

'All header information
Set body = mDoc.CreateMIMEEntity

'I also uncommented that, but it didn't help
'Set header = body.CreateHeader("Subject")
'Call header.SetHeaderVal(doc.Subject(0))
'Set header = body.CreateHeader("To")
'Call header.SetHeaderVal(doc.SendTo(0))
'Set header = body.CreateHeader("From")
'Call header.SetHeaderVal(doc.From(0))
'Set header = body.CreateHeader("Content-Type")
'Call header.SetHeaderVal("text/html")
Forall hbv In mHTMLBody.Values
Call stream.WriteText(hbv,EOL_PLATFORM)
End Forall
Call body.SetContentFromText(stream,"text/html", ENC_NONE)

'Save the MIME - Comment/Uncomment - no difference
'Call mDoc.CloseMIMEEntities(True)

'Populate "normal" fields
mDoc.Form = "Memo"
mDoc.From = doc.From
mDoc.Subject = doc.Subject
mDoc.SendTo = doc.SendTo
mDoc.Recipients = doc.SendTo
Call mDoc.Save(True, True)
'Save/No Save no difference
Call mDoc.Send(False)
'I don't need it
Call mDoc.Remove(True)

Exit Sub

Print "Error in MailThisDoc "
Print Err
Print Error$
Resume Exit_MailThisDoc
End Sub

Go back